Page({

  /**
   * 页面的初始数据
   */
  data: {
    tit:"tit1",
    bannerImg: ["../../images/jpg/banner.jpg", "../../images/jpg/banner.jpg"],
    merchant:{
      id:12323,
      headPic:"../../images/jpg/head_pic.jpg",
      title:"旭泽牛羊肉批发",
      star:5,
      share:33,
      view:232323,
      address:"河北省衡水市桃城区",
      workTime:"07:00-17:00",
      tel:136283677888,
      support:{
        wifi:true,
        park:true
      },
      content:{
        des:"牛腱子，牛腩，牛碎肉，肥牛，牛排,",
        img: ["../../images/jpg/banner.jpg", "../../images/jpg/banner.jpg"]
      },
      message:[
        {
          id:132323,
          headPic:"../../images/jpg/head_pic.jpg",
          name:"张三",
          addTime:"2018-02-24",
          txt:"好好好",
          star:5
        },
        {
          id: 132323,
          headPic: "../../images/jpg/head_pic.jpg",
          name: "张三",
          addTime: "2018-02-24",
          txt: "好好好",
          star: 5
        },
        {
          id: 132323,
          headPic: "../../images/jpg/head_pic.jpg",
          name: "张三",
          addTime: "2018-02-24",
          txt: "好好好",
          star: 0
        }
      ],
      code:"../../images/jpg/code.jpg",
      weixinCode: "../../images/jpg/code.jpg",
      xiaoCode:"../../images/jpg/code.jpg",
      collect:false
    },
    rightBtn:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '猪副冻品批发',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  },
  changeNav(e) {
    this.setData({tit:e.target.id});
  },
  showLocation() {
      wx.openLocation({
          latitude:13.02312,
          longitude:130.23912,
          scale:10,
          name:"测试地址",
          address:"地址说明"
      })
  },
  goRuzhu() {
      wx.navigateTo({
          url: '../merchant_ruzhu/merchant_ruzhu',
      })
  },
  showCode(e) {
    let id = e.target.dataset.kind;
    this.setData({ rightBtn:id});
  },
  cancel(e) {
    this.setData({rightBtn:0});
  },
  send(e) {
      this.setData({ rightBtn: 0 });
  },
  footBtn(e) {
    let id = e.target.dataset.id || e.currentTarget.dataset.id;
    if(id == 1){
        wx.switchTab({
            url: '../index/index',
        })
    }else if(id ==2){
        let merchant = this.data.merchant;
        merchant.collect = !merchant.collect;
        this.setData({ merchant: merchant })
    }else if(id ==3) {
        wx.openLocation({
            latitude: 13.02312,
            longitude: 130.23912,
            scale: 10,
            name: "测试地址",
            address: "地址说明"
        })
    }
  }
})